package builder;

import builder.simple.Student;

//这种方式是通过改变Director的传入参数Builder不同的产品
//也可以将差异放置在ProductBuilder中，不同的Product对应不同的ProductBuilder
//具体可以根据业务场景选择
//--------------------------------
//还有一种方式可以用来初始化类，可以参考org.apache.http.client.config构造方式

public class Setup {
	public static void main(String[] args) {
		
		ProductBuilder builder = new ProductBuilder();
		Director director = new Director(builder);
		director.construct("Builder","Product1");
		Product product = builder.build();

		System.out.println(product);
		
		
		ProductBuilder builder2 = new ProductBuilder();
		Director director2 = new Director(builder2);
		director2.construct("Builder","Product2");
		Product product1 = builder2.build();

		System.out.println(product1);
		
		
		//初始化类，可以减少过多的构造函数
		Student a = new Student.StudentBuilder().setAge(13).setName("LiHua").build();
		Student b = new Student.StudentBuilder().setSchool("sc").setSex("Male").setName("ZhangSan").build();
		System.out.println(a);
		System.out.println(b);
		
	}
}
